package lyl.heap;

import java.util.Comparator;
import java.util.PriorityQueue;

public class PriorityQueueEx {
    public static void main(String[] args) {
        PriorityQueue<Integer> heap = new PriorityQueue<>(3,new Comparator<Integer>() {
            @Override
            public int compare(Integer t1, Integer t2) {

                return t1 - t2;
            }
        });
        heap.add(4);
        heap.add(3);
        heap.add(6);
        heap.add(1);
        heap.add(9);
        System.out.println(heap.poll());
        System.out.println(heap.poll());

    }
}
